#!/usr/bin/perl -w

##HACKABOT_HELP##
# Whip someone!
# !whip [someone] | --add some new whip
##HACKABOT_HELP##

use strict;
use Hackabot::Client;

my $hbc = Hackabot::Client->new;
my $msg = $hbc->readline;
my $nick = $hbc->sent_by;
my $chan = $hbc->channel;

if ($msg =~ /^--add\s+(.+)/) {
	chomp $1;
    $hbc->quote_add("whip", $1);
    print "send $nick: Successfully added\n";
}
elsif ($hbc->private) {
	print "send I'll whip you!!!\n";
}
else {
    if ($msg eq "") {
        my @names = $hbc->names($chan);
        $msg = $names[int(rand(@names))];
	}

    my $whip = $hbc->quote_get("whip");

    print "me whips $msg with a $whip.\n";
}
